<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>嵌套计数器</title>
<style>
body {
    counter-reset: section;
}
h1 {
    counter-reset: subsection;
}
h1::before {
    counter-increment: section;
    content: "section" counter(section) ".";
}
h2::before {
    counter-increment: subsection;
    content: counter(section) "." counter(subsection) "";
}
</style>
</head>
<body>
<h1>HTML教程：</h1>
<h2>HTML教程</h2>
<h2>css教程</h2>


<h1>scripting教程：</h1>
<h2>javascript</h2>
<h2>vbscript</h2>


<h1>xml教程：</h1>
<h2>xml</h2>
<h2>xsl</h2>


<p><b>注意：</b>IE8需要指定!DOCTYPE才可以支持该属性。</p>
</body>
</html>